package com.easywan.web.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.easywan.core.HTMLModelAndView;
import com.easywan.core.RedirectModelAndView;
import com.easywan.service.AdminService;
import com.easywan.vo.Admin;

@Controller
@RequestMapping("admin")
public class LoginControllerMnager {
	@Autowired
	AdminService adminService;
	@RequestMapping("login")
	public ModelAndView login_html(){
		
		return new HTMLModelAndView("admin/login/login");
	}
	@RequestMapping("login_chk")
	public ModelAndView login(Admin admin){
		Admin user = adminService.login(admin);
		if(user == null){
			return new RedirectModelAndView("admin/login");
		}
		return new RedirectModelAndView("admin/index");
	}
}
